/*
 *
 * Copyright (C) 2012 Walter Lütgenau
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */
package offset.nodes.server.view.tags;

import javax.faces.webapp.UIComponentTag;
import javax.faces.component.UIComponent;
import offset.nodes.server.view.FacesUtils;
import offset.nodes.server.view.component.applet.AppletComponent;

public class AppletTag extends BasicTag {

    String elementId = null;
    String function = null;
    String generateCode = null;
    String appletId = null;
    String height = null;
    String width = null;
    String code = null;
    String codebase = null;
    String jar = null;
    String jre = null;

    // Associate the renderer and component type.
    public String getComponentType() {
        return "nodes.faces.applet";
    }

    public String getRendererType() {
        return null;
    }

    @Override
    public void setProperties(UIComponent component) {
        super.setProperties(component);

        // set properties
        setAttribute(component, AppletComponent.PAR_ELEMENT_ID, elementId);
        setAttribute(component, AppletComponent.PAR_FUNCTION, function);
        setAttribute(component, AppletComponent.PAR_GENERATE_CODE, generateCode);
        setAttribute(component, AppletComponent.PAR_APPLET_ID, appletId);
        setAttribute(component, AppletComponent.PAR_HEIGHT, height);
        setAttribute(component, AppletComponent.PAR_WIDTH, width);
        setAttribute(component, AppletComponent.PAR_CODE, code);
        setAttribute(component, AppletComponent.PAR_CODEBASE, codebase);
        setAttribute(component, AppletComponent.PAR_JAR, jar);
        setAttribute(component, AppletComponent.PAR_VERSION, jre);
    }

    @Override
    public void release() {
        super.release();
        elementId = null;
        function = null;
        generateCode = null;
        appletId = null;
        height = null;
        width = null;
        code = null;
        codebase = null;
        jar = null;
        jre = null;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setCodebase(String codebase) {
        this.codebase = codebase;
    }

    public void setElementId(String elementId) {
        this.elementId = elementId;
    }

    public void setFunction(String function) {
        this.function = function;
    }

    public void setAppletId(String appletId) {
        this.appletId = appletId;
    }

    public void setHeight(String height) {
        this.height = height;
    }

    public void setJar(String jar) {
        this.jar = jar;
    }

    public void setWidth(String width) {
        this.width = width;
    }

    public void setJre(String jre) {
        this.jre = jre;
    }

    public void setGenerateCode(String generateCode) {
        this.generateCode = generateCode;
    }

}
